//
//  AddressAPI.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2023/4/17.
//  Copyright © 2023 zwb. All rights reserved.
//

import UIKit
import Moya

public enum AddressAPI {
    
 
    
    case queryProvince(parent_id:String)
   
 }

extension AddressAPI: TargetType {
    
    public var baseURL: URL {
      
            return URL(string: HTTPStr)!
        
    }
    
    public var path: String {
        switch self {
     
              case .queryProvince:
            return "/PfoodClientController/queryProvince"
     
        }
    }
    
    public var method: Moya.Method {
     
            return .post
       
    }
    
    public var sampleData: Data {
        return "{}".data(using: String.Encoding.utf8)!
    }
    
    public var task: Task {
        switch self {
  
        
        default:
            
           let rrr = testXXX(self)
            let ooo =  Mirror(reflecting: self)
            if let ddd = rrr as? [String:Any] {
                let dic = ddd[ooo.children.first?.label ?? ""]! as! [String : Any]
                return .requestParameters(parameters: dic, encoding: URLEncoding.default)
            } else {
                return .requestPlain
            }

        }
    }
    
    public var headers: [String : String]? {
        return getBaseInfoDic()
    }
    
}
